package com.itheima.jdbcTemplate;

import com.itheima.dao.AccountDao;
import com.itheima.po.Account;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * ClassName:JdbcTemplateDemo
 * Package:com.itheima.jdbcTemplate
 * Description:jdbc的使用Dao
 * Date:2020/2/25 23:18
 * User: snow
 */
public class JdbcTemplateDemo4 {
	public static void main(String[] args) {
		//1、获取容器
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
		//2、创建对象
		AccountDao accountDao = applicationContext.getBean("accountDao", AccountDao.class);
		//执行查找操作
		Account account = accountDao.findAccountById(14);
		System.out.println(account);
		// 执行更新操作

		account.setName("flower");
		accountDao.updateAccount(account);
		System.out.println(account);
	}
}
